Repository navigation
Conversation
Contributor
|
Flags count bits from the least significant bit, as enum reads its index. A variant compares discriminants as unsigned integers, so 0 and "0x00" are the same discriminant. Array and struct now state their standard interpretations. Function says that it has none yet.
An unknown complex kind must give `contains`, so a consumer that does not know the kind can find its child types. Variant and function must not give `contains`; they give their parts in their own fields. Their examples now give `class: complex`, and the base and type schemas say that the base rule is for kinds a consumer does not know. Also remove a stale `discriminant` field from a test fixture.
A known elementary kind must not give `contains`, and a type reference must not have fields other than `id`. The schemas rejected both; the guards accepted them. A value with an `id` is now a specifier only if it is a reference, as the specifier schema says.
… reads The docs now say that a consumer dispatches on a known kind by `kind`, and that an unknown complex kind gives `contains`. They also give the flags bit order and how a variant compares discriminants.
A type with an old kind still validates as an unknown kind if it gives `class`; it then has no meaning. The format reserves no kind names. The entries now also give the flags bit order, the variant discriminant comparison, and the guard changes.
An array type had no label, so a fixed-size array and a dynamic array gave the same type object. The label now gives the BUG spelling, e.g. array<uint256, 3>.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This rewrites the ethdebug/format/type schemas for #282. A type now says what a value is. The pointer says where the value's bytes are, so widths, sizes and counts leave the types. Interpretations (decoders) turn a type and a pointer into a value, and a language that needs more can add its own kinds.
The old kinds go away in this release. Nothing is deprecated.
Kinds
Elementary:
uint,int,ufixedandfixed: optionalsigned(default false) andplaces(default 0). Nobits.contract: optionalpayable; an optionaldefinitionmakes the address a contract reference, and the definition carries thelibrary/interfacehints.flag). Bitiis the bit with the value2**i.byteslosessize.enumrequires one or more unique stringvalues.boolandstringare unchanged apart fromlabel.Complex:
tuple(members without names). An empty struct is legal.casesof{name, discriminant, payload?}. The discriminant is compared as an unsigned integer, so0and"0x00"are the same discriminant.arraylosescount.functiontakes top-levelparametersandreturnslists (returns: []means no values) in place ofcontains; an external function may name itscontractas an address with a definition.aliasandmappingkeep their shape.Every type may carry
label, the type as the language spells it (uint256,bytes32,address[10]). It is for display only.Each kind's description states its standard interpretation, except
function, which has none yet. Realizations, which describe which regions of a pointer hold which parts of a type, come in a later PR.Unknown kinds
The base rule (
classandcontains) is for kinds that a consumer does not know. An unknown kind givesclass, and an unknown complex kind must put its child types undercontains. A consumer dispatches on a known kind bykind.classstays optional on known kinds, andvariantandfunctionmust not givecontains, so withoutclassthese two look elementary to the base rule. Their schema examples giveclass: complex. A base complex type may now omitcontainswhen it givesclass: complex, so an unknown kind can hold a known variant or function.Producers and consumers
This is breaking for both. A type with an old kind validates only as an unknown kind: it must give
class, and it then has no meaning. The format reserves no kind names.bits,sizeandcountstill pass validation as extra fields, but they no longer mean anything. A function or variant withcontainsdoes not validate.@ethdebug/format: the TS types and guards follow the new kinds; the old ones are removed. The guards now also reject an elementary type withcontainsand a type reference with fields other thanid, as the schemas do.label(for example{kind: "number", signed: true, label: "int8"}, orarray<uint256, 3>for an array). It also stops emittinglengthon arrays, a field the old schema did not define.label, or else its kind.typestable. Conformance now validates solc's resources with an emptytypestable, and a tripwire test fails once solc's table validates (conformance: solc emits the old type kinds #423).